# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
pkgname=browserpass
pkgver=3.0.8
pkgrel=3
pkgdesc="Browser extension for pass"
url="https://github.com/browserpass/browserpass-native"
arch="all"
license="MIT"
depends="pass"
makedepends="go git"
source="$pkgname-$pkgver.tar.gz::https://github.com/browserpass/browserpass-native/archive/$pkgver.tar.gz"
builddir="$srcdir/browserpass-native-$pkgver"

build() {
	make browserpass configure GOFLAGS="$GOFLAGS -trimpath"
}

check() {
	make test GOFLAGS="$GOFLAGS"
}

package() {
	install -dm0755 "$pkgdir"/usr/bin \
		"$pkgdir"/usr/lib/mozilla/native-messaging-hosts \
		"$pkgdir"/etc/chromium/native-messaging-hosts \
		"$pkgdir"/etc/chromium/policies/managed

	install -m0755 browserpass "$pkgdir"/usr/bin/browserpass

	local targetname=com.github.browserpass.native.json

	install -m644 browser-files/firefox-host.json "$pkgdir"/usr/lib/mozilla/native-messaging-hosts/$targetname

	install -m644 browser-files/chromium-host.json "$pkgdir"/etc/chromium/native-messaging-hosts/$targetname
	install -m644 browser-files/chromium-policy.json "$pkgdir"/etc/chromium/policies/managed/$targetname
}

sha512sums="
c854e671153694bf87f8393e284983d213f31c46cbbc4e6fd892e1793b8aa59d81c257f0709334667b533a9570dc5819662c2bc7d165133398c9149fcc1eb1d0  browserpass-3.0.8.tar.gz
"
